#ifndef BIO_PH_REACTION_INCLUDED
#define BIO_PH_REACTION_INCLUDED 1

#include "kernel/library.hpp"
#include "yocto/sequence/vector.hpp"

class Reaction
{
public:
	explicit Reaction( const string & _name, const Library &lib, lua_State *L, const string & _K );
	virtual ~Reaction() throw();
	Reaction( const Reaction & );
	
	const string         name;
	Lua::Function<Real>  K;
	const Library       &library;
	
	const string & key() const throw(); //!< for ReactionSet
	
	class Item
	{
	public:
		const string id; //!< reactant/product
		const int    nu;   //!< nu>0: product, nu<0: reactant
		Item( const string & _id, const int _nu );
		~Item() throw();
		Item( const Item & );
		
	private:
		YOCTO_DISABLE_ASSIGN(Item);
	};
	
	void append( const int nu, const string &id );
	const array<Item> & items() const throw();
	
	Real getK( Real t ) const;
	
private:
	vector<Item> items_;
	YOCTO_DISABLE_ASSIGN(Reaction);
};

#endif
